home *** CD-ROM | disk | FTP | other *** search
- 'Fancy CIS logon script
- 'Stores ID and password in STORM.INI file in [CompuServe] section
- 'Password
- Loop:
- FAST ON
- UserID$ = SET$("STORM","CompuServe","ID")
- temp$ = SET$("STORM","CompuServe","Password")
- Password$ = ""
- 'Basic glitch, FOR loop will always be executed once!
- 'So check length first
- IF LEN(temp$) > 0 THEN
- FOR x = 1 TO LEN(temp$)
- Password$ = Password$ + CHR$( ASC( MID$(temp$,x,1)) XOR 255)
- NEXT x
- ENDIF
- IF LEN(UserID$) = 0 OR LEN(Password$) = 0 THEN
- GOSUB Setup
- IF LEN(UserID$) = 0 OR LEN(Password$) = 0 THEN
- GOTO Loop
- ELSE
- PRINT "Setup Complete"
- PRINT "Thank you"
- PRINT "========="
- END
- ENDIF
- ENDIF
- Tries = 7
- ETX$ = CHR$(3)
- CompuServeHost$ = "CIS" + CHR$(13)
- FailStr$ = ""
- FirstTry = -1
- '
- TOPW 1
- TERM OFF :'Ensure don't miss anything
- FAST OFF
- PAUSE 2
- SEND ETX$;
- '
- StartConnect:
- IF Tries = 0 THEN CIS_Failure
- Tries = Tries - 1
- '
- Connect_Wait:
- WAIT 80,"UIC:","Host Name:","User ID:","Password:"
- ON WAIT(0) GOTO Send_ETX,Send_Host_Name,Send_ID,Send_Password
- GOTO Send_CR
- '
- Send_CR:
- SEND CHR$(13)
- GOTO Connect_Wait
- '
- Send_Host_Name:
- SEND CompuServeHost$
- GOTO Connect_Wait
- '
- Send_ID:
- PRINT "Logging onto CompuServe"
- SEND UserID$ + "\" + Password$
- GOTO Logon_Wait
- '
- Send_Password:
- SEND Password$
- '
- Logon_Wait:
- WAIT 60,"CompuServe", CHR$(6),"? LOG","?? LOG"," NTW"
- ON WAIT(0) GOTO Success,Success,Log_Msg,Log_Msg,Logon_Failure
- GOTO Cis_Failure
- '
- Log_Msg:
- WAIT 50,"INE","ISX","SIL","SIU","SNA","STU","INS"
- ON WAIT(0) GOTO Bad_ID,Bad_ID_Syntax,System_NA,System_NA,System_NA,System_NA,Invalid_Switch
- GOTO Try_Again
- '
- Bad_ID:
- FailStr$ = "Incorrect user ID or password"
- GOTO Try_Again
- '
- Bad_ID_Syntax:
- FailStr$ = "Incorrect user ID syntax"
- GOTO Try_Again
- '
- System_Unavailable:
- FailStr$ = "The system is unavailable, try again later"
- GOTO CIS_Failure
- '
- Invalid_Switch:
- FailStr$ = "Invalid Switch"
- 'fall through to Try_again
- Try_Again:
- IF NOT FirstTry THEN CIS_Failure
- SEND ETX$;
- FirstTry = 0
- '
- WAIT 30,"User ID"
- IF WAIT(0) = 1 THEN Send_ID ELSE CIS_Failure
- '
- Logon_Failure:
- PRINT "Remote is busy or unavailable"
- TOPW 3
- END
- '
- CIS_Failure:
- PRINT FailStr$
- TOPW 3
- END
- '
- Success:
- PRINT "Logged on!"
- END
- 'First time setup for CompuServe
- Setup:
- TOPW 3:CLS :PRINT "Welcome to Storm's CompuServe Setup Script"
- PRINT "==========================================":PRINT
- IF LEN(UserID$) > 0 THEN GetPassword
- RepeatID:
- PRINT
- PRINT "Please enter your User ID";
- 'Require LINE INPUT since ID contains a comma!
- LINE INPUT UserID$
- GOSUB ValidateID
- IF LEN(UserID$) = 0 THEN RepeatID
- 'Since ID was absent, assume password was as well
- IF BadBoy THEN PRINT "Thank you for cooperating"
- GetPassword:
- PRINT
- PRINT "Please enter your password";
- LINE INPUT Password$
- IF LEN(Password$) = 0 THEN RepeatPassword
- temp$ = ""
- 'Simple hack to encrypt password
- 'Turns it into unreadable graphics/foreign characters
- FOR x = 1 TO LEN(Password$)
- temp$ = temp$ + CHR$( ASC( MID$(Password$,x,1)) XOR 255)
- NEXT x
- PRINT "Your User ID is ";UserID$
- PRINT "Your Password is ";Password$
- PRINT "Is that correct (Y/N)"
- INPUT confirm$
- confirm$ = UCASE$( LEFT$(confirm$,1))
- IF confirm$ <> "Y" THEN RepeatID
- SET "STORM","CompuServe","Password",temp$
- SET "STORM","CompuServe","ID",UserID$
- RETURN
- 'Validate by looking for a single comma and the rest digits
- 'Another way would be by using the VAL function
- 'e.g. VAL("72227,3507") is 72227.
- 'I presume there is an extreme lower and upper limit for
- 'all possible PPN's.
- ValidateID:
- IF LEN(UserID$) = 0 THEN RETURN
- IF INSTR(UserID$,",") = 0 THEN GOSUB BadID:RETURN
- ComCount = 0
- FOR x = 1 TO LEN(UserID$)
- x$ = MID$(UserID$,x,1)
- IF NOT ISDIGIT(x$) THEN
- IF x$ <> "," THEN
- GOSUB BadID
- RETURN
- ELSE
- ComCount = ComCount + 1:'Can only have one!
- IF ComCount > 1 THEN GOSUB BadID:RETURN
- ENDIF
- ENDIF
- NEXT x
- RETURN
- BadID:
- PRINT "[";UserID$;"] is not a valid CompuServe ID"
- PRINT "I wish you would be more cooperative":PRINT
- BadBoy = 1
- UserID$ = ""
- RETURN
-
-